<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>mytestAdmin</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
		<link rel="stylesheet" href="./css/font.css">
		<link rel="stylesheet" href="./css/xadmin.css">
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="./js/xadmin.js"></script>
		<script src="js/config.js" type="application/javascript"></script>
		<script src="js/echarts.min.js"></script>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	</head>

	<body>

		<div class="x-body">
			<div style="width:100%; height:80px"><button class="layui-btn" onclick="fresh()"><i class="layui-icon">ဂ</i></button></div>
			<div id="main" style="width: 450px;height:300px; float: left;"></div>
			<div id="main2" style="width: 450px;height:300px; float: left;"></div>
		</div>
		<script type="text/javascript">
			var datacount,id,datacount2;
			layui.use(['layer'], function() {
				var layer = layui.layer;
				$.ajax({
					url: base_url + '/project/tongji/fenlei',
					contentType: 'application/json; charset=utf-8',
					type: 'get',
					data: '',
					dataType: 'json',
					async: false,
					success: function(result) {
						if(result.code = '0') {
							var myChart = echarts.init(document.getElementById('main'));
							datacount = result.data;
							option = {
								title: {
									text: '用例分类统计图',
									x: 'center'
								},
								tooltip: {
									trigger: 'item',
									formatter: "{a} <br/>{b} : {c} ({d}%)"
								},
								series: [{
									name: '所属分类',
									type: 'pie',
									radius: '55%',
									center: ['50%', '60%'],
									data: datacount,
									itemStyle: {
										emphasis: {
											shadowBlur: 10,
											shadowOffsetX: 0,
											shadowColor: 'rgba(0, 0, 0, 0.5)'
										}
									}
								}]
							};
							myChart.setOption(option);
						}
					}
				});
				
				$.ajax({
					url: base_url + '/project/tongji/excute',
					contentType: 'application/json; charset=utf-8',
					type: 'get',
					data: '',
					dataType: 'json',
					async: false,
					success: function(result) {
						if(result.code = '0') {
							var myChart = echarts.init(document.getElementById('main2'));
							datacount2 = result.data;
							option = {
								title: {
									text: '用例执行状态统计图',
									x: 'center'
								},
								tooltip: {
									trigger: 'item',
									formatter: "{a} <br/>{b} : {c} ({d}%)"
								},
								series: [{
									name: '执行状态',
									type: 'pie',
									radius: '55%',
									center: ['50%', '60%'],
									data: datacount2,
									itemStyle: {
										emphasis: {
											shadowBlur: 10,
											shadowOffsetX: 0,
											shadowColor: 'rgba(0, 0, 0, 0.5)'
										}
									}
								}]
							};
							myChart.setOption(option);
						}
					}
				});
				
			});
		</script>
	</body>

</html>